#include "statustypedata.h"
#include "statustypegroup.h"
#include "statustypemanager.h"
#include "statustype.h"
#include "status.h"
#include <stdio.h>


Status::Status(StatusType statusType, const QString &description) :
    m_description(description)
{
    setType(statusType);
}


Status::Status(const Status& copyMe) :
    m_type(copyMe.m_type),
    m_group(copyMe.m_group),
    m_description(copyMe.m_description),
    m_displayName(copyMe.m_displayName)
{
}


Status::~Status()
{
}


void Status::setType(StatusType type)
{
    m_type = type;
    const StatusTypeData & typeData = StatusTypeManager::instance()->statusTypeData(m_type);
    m_displayName = typeData.displayName();
    m_group = typeData.typeGroup();
}


bool Status::isDisconnected() const
{
    return StatusTypeGroupOffline == m_group;
}


bool Status::operator < (const Status &compare) const
{
    return m_type < compare.m_type;
}


bool Status::operator == (const Status &compare) const
{
    return m_type == compare.m_type
            && m_description == compare.m_description;
}


bool Status::operator != (const Status& compare) const
{
    return !(*this == compare);
}


bool Status::hasDescription() const
{
    return !m_description.isEmpty();
}
